#include "Seg.h"

unsigned char code Seg_Wei[] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
unsigned char code Seg_Duan[] = {0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x90, 0xFF, 0xC6, 0x86, 0x89, 0xBF};

void Seg_Display(unsigned char wei, duan, point)
{
  P0 = 0xFF;
	P2 = P2 & 0x1F | 0xE0;
	P2 = P2 & 0x1F;
  
  P0 = Seg_Wei[wei];
  P2 = P2 & 0x1F | 0xC0;
	P2 = P2 & 0x1F;
  
  P0 = Seg_Duan[duan];
  if(point) P0 &= 0x7F;
  P2 = P2 & 0x1F | 0xE0;
	P2 = P2 & 0x1F;
}